package com.lagou.controller;

import com.lagou.Annotion.MyAutoWired;
import com.lagou.Annotion.MyController;
import com.lagou.Annotion.MyResultMapping;
import com.lagou.Annotion.MySecurity;
import com.lagou.pojo.User;
import com.lagou.service.UserService;

import java.util.List;

/**
 * @Authther: mrwu
 * @date:2021/3/21-03
 * @Description:com.lagou.controller
 */
@MyResultMapping("/user")
@MyController
public class UserController {
    @MyAutoWired
    private UserService userService;

    /**
     * 查询所有用户信息
     * @return
     */
    @MyResultMapping("/get")
    public List<User> getUser(){
      return   userService.selectAll();
    }

    /**
     * 根据名称查询用户信息
     * @param name
     * @return
     */
    @MySecurity({"zhangsan","lisi"})
    @MyResultMapping("/detail")
    public User getdetail(String name){
        return userService.findByUserName(name);
    }
}
